#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void main34() {
    long x;
    int a, b, c, d, e;
    while (1) {
        scanf("%ld", &x);
        if (x > 99999)
            printf("输入的数值不合法\n");

        else {
            if ((x > 9999) && (x < 100000)) {
                printf("该数为5位数\n");
                a = x / 10000;
                b = (x % 10000) / 1000;
                c = ((x % 10000) % 1000) / 100;
                d = (((x % 10000) % 1000) % 100) / 10;
                e = (((x % 10000) % 1000) % 100) % 10;
                printf("逆序为%1d%1d%1d%1d%1d\n", e, d, c, b, a);
                printf("该数为5位数\n");
            } else {
                if ((x > 999) && (x < 10000)) {
                    a = x / 1000;
                    b = (x % 1000) / 100;
                    c = ((x % 1000) % 100) / 10;
                    d = ((x % 1000) % 100) % 10;
                    printf("逆序为%1d%1d%1d%1d\n", d, c, b, a);


                    printf("该数为4位数\n");
                } else {
                    if ((x > 99) && (x < 1000)) {
                        a = x / 100;
                        b = (x % 100) / 10;
                        c = (x % 100) % 10;
                        printf("逆序为%1d%1d%1d\n", c, b, a);

                        printf("该数为3位数\n");
                    } else {
                        if ((x > 9) && (x < 100)) {
                            a = x / 10;
                            b = x % 10;
                            printf("逆序为%1d%1d\n", b, a);


                            printf("该数为2位数\n");
                        } else {
                            if ((x > -1) && (x < 10)) {
                                a = x % 10;
                                printf("逆序为%1d\n", a);
                                printf("该数为1位数\n");
                            } else
                                printf("请输入一个小于5位的正数！\n");
                        }
                    }
                }
            }
        }
    }


}


void main35() {
    int a[10][10] = {0};
    int i, j;
    for (i = 0; i < 10; i++) {
        a[i][0] = 1;
        a[i][i] = 1;
    }
    for (i = 2; i < 10; i++)
        for (j = 1; j < i; j++)
            a[i][j] = a[i - 1][j - 1] + a[i - 1][j];

    for (i = 0; i < 10; i++) {
        for (j = 0; j <= i; j++)
            printf("%-4d", a[i][j]);

        printf("\n");

    }
}


void main36() {
    int a = 10;
    int *p = &a;
    printf("%d\n", a);
    printf("%d\n", &a);
    printf("%d\n", *p);
    printf("%d\n", p);
}


void main37() {
    printf("\t\t\t****************************\n");
    printf("\t\t\t********欢迎您的使用********\n");
    printf("\t\t\t******学生学分管理程序******\n");
    printf("\t\t\t******     1- 显示    ******\n");
    printf("\t\t\t******     2- 查询    ******\n");
    printf("\t\t\t******     3- 统计    ******\n");
    printf("\t\t\t******     0- 退出    ******\n");
    printf("\t\t\t****************************\n");
}


void main38() {
    int longest(char string[]);
    char string[100] = {"I love you however you do not love me"};
    longest(string);

}

int longest(char *string) {
    int len = 0, i, n, length = 0, flag = 1, place = 0, point;
    n = strlen(string);
    for (i = 0; i <= n; i++)
        if (string[i] != ' ')
            if (flag) {
                point = i;
                flag = 0;
            } else len++;
        else {
            flag = 1;
            if (len > length) {
                length = len;
                place = point;
                len = 0;
            }
        }

    printf("最长单词的起始位置:%d\n最长单词的长度:%d\n", place + 1, length - 1);
    int j;
    for (j = place; j <= place + length - 2; j++)
        printf("%c", string[j]);

    return 0;

}


void main39()
{
    int i,m,n,k;
    char c='A';

    printf("输出多少排\n");
    scanf("%d",&k);
    for(i=1;i<=k;i++)
    {
        for(m=1;m<=k-i;m++)
            printf(" ");
        for(n=1;n<=2*i-1;n++)
            printf("%c",c);
        c=c+1;
        printf("\n");
    }
    printf("\n");
}
